﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class MyAccount : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.DisplayAccount();
        Response.Redirect("Default.aspx");
        //this.DisplayOrders();
    }

    void DisplayOrders()
    {
        //DataTable table = (DataTable)Session["ThanhVien"];
        //String sql = "SELECT * FROM Orders WHERE CustomerID=@CustomerID";

        //String CustomerID = table.Rows[0]["CustomerID"].ToString();
        //DataTable Orders = Database.GetData(sql, "@CustomerID", CustomerID);

        //GridView1.DataSource = Orders;
        //GridView1.DataBind();
    }

    void DisplayAccount()
    {
        DataTable table = (DataTable)Session["ThanhVien"];

        txtCustomerID.Text = (String)table.Rows[0]["UserName"];
        txtAddress.Text = (String)table.Rows[0]["Address"];
        txtEmail.Text = (String)table.Rows[0]["PersonalID"];
        txtFullName.Text = (String)table.Rows[0]["Name"];
        
        txtPassword.Text = (String)table.Rows[0]["Password"];
       
        
    }


    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        //String sql = "UPDATE Customers SET FullName=@FullName, Address=@Address, Email=@Email, Password=@Password, Phone=@Phone WHERE CustomerID=@CustomerID";
        //try
        //{
        //    Database.ExecuteNonQuery(sql,
        //            "@CustomerID", txtCustomerID.Text,
        //            "@FullName", txtFullName.Text,
        //            "@Address", txtAddress.Text,
        //            "@Email", txtEmail.Text,
        //            "@Password", txtPassword.Text,
        //            "@Phone", txtPhone.Text);
        //    lblError.Text = "Cập nhật thành công !";
        //}
        //catch (Exception ex)
        //{
        //    lblError.Text = ex.Message;
        //}
    }
}
